package com.ruoyi.project.lesson.lessoncode.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;
import com.ruoyi.project.lesson.lessoncode.domain.LessonActivationCode;
import com.ruoyi.project.lesson.lessoncode.mapper.LessonActivationCodeMapper;
import com.ruoyi.project.lesson.lessoncode.service.ILessonActivationCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课程激活码Service业务层处理
 *
 * @author shixiangwen
 * @date 2021-04-20
 */
@Service
@DataSource(DataSourceType.KKFORMULA)
public class LessonActivationCodeServiceImpl implements ILessonActivationCodeService {

    @Autowired
    private LessonActivationCodeMapper lessonActivationCodeMapper;

    /**
     * 查询课程激活码
     *
     * @param id 课程激活码ID
     * @return 课程激活码
     */
    @Override
    public LessonActivationCode selectLessonActivationCodeById(Long id) {
        return lessonActivationCodeMapper.selectLessonActivationCodeById(id);
    }

    /**
     * 查询课程激活码列表
     *
     * @param lessonActivationCode 课程激活码
     * @return 课程激活码
     */
    @Override
    public List<LessonActivationCode> selectLessonActivationCodeList(LessonActivationCode lessonActivationCode) {
        return lessonActivationCodeMapper.selectLessonActivationCodeList(lessonActivationCode);
    }

    /**
     * 新增课程激活码
     *
     * @param lessonActivationCode 课程激活码
     * @return 结果
     */
    @Override
    public int insertLessonActivationCode(LessonActivationCode lessonActivationCode) {
        return lessonActivationCodeMapper.insertLessonActivationCode(lessonActivationCode);
    }

    /**
     * 修改课程激活码
     *
     * @param lessonActivationCode 课程激活码
     * @return 结果
     */
    @Override
    public int updateLessonActivationCode(LessonActivationCode lessonActivationCode) {
        return lessonActivationCodeMapper.updateLessonActivationCode(lessonActivationCode);
    }

    /**
     * 删除课程激活码对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteLessonActivationCodeByIds(String ids) {
        return lessonActivationCodeMapper.deleteLessonActivationCodeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除课程激活码信息
     *
     * @param id 课程激活码ID
     * @return 结果
     */
    @Override
    public int deleteLessonActivationCodeById(Long id) {
        return lessonActivationCodeMapper.deleteLessonActivationCodeById(id);
    }
}
